import pytest
from selenium import webdriver
from common.mysql_tools import connect, excute, disconnect


@pytest.fixture(scope="session")
def db_clean():
    conn=connect()
    excute(conn,"delete from sys_user where account like 'test%' ")
    yield
    disconnect(conn)

@pytest.fixture()
def get_driver():
    #setup
    driver =webdriver.Chrome()
    # 隐式等待:在等待时间内整个页面完成加载,则执行代码，否则抛出异常。
    # driver.implicitly wait(10)#00
    driver.get("http://192.168.1.138/ranzhi/www/sys/index.html/")
    driver.maximize_window()
    yield driver# yield 相当于 return
    # teardown
    driver.quit()